//
//  MineHeaderView.m
//  QXShowing
//
//  Created by 王道道 on 2018/4/19.
//  Copyright © 2018年 doll_dream. All rights reserved.
//

#import "MineHeaderView.h"

@implementation MineHeaderView

- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = Bg_Color_F9F9F9;
        [self setUpUI];
        [self _viewLzyout];
    }
    return self;
}

- (void)setUpUI {
    self.nameLabel = [[UILabel alloc]init];
    self.nameLabel.text = @"浙江天湖国际有限公司";
//    self.nameLabel.backgroundColor = [UIColor blueColor];
    [self addSubview:self.nameLabel];
    
    self.headImage = [[UIImageView alloc]init];
    self.headImage.clipsToBounds = YES;
    self.headImage.layer.cornerRadius = 50;
    self.headImage.image = [UIImage imageNamed:@"login-6"];
    [self addSubview:self.headImage];
    
    UIButton *button = [[UIButton alloc] init];
    //    [button setTitle:@"" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(nameButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:button];
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.headImage.mas_top);
        make.bottom.equalTo(self.nameLabel.mas_bottom);
        make.left.equalTo(self.headImage.mas_left);
        make.centerX.equalTo(self.mas_centerX);

    }];
}

- (void)_viewLzyout {
    [self.headImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.centerY.equalTo(self).offset(-20);
        make.height.width.offset(100);
    }];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self.headImage.mas_bottom).offset(10);
    }];
}

//- (void)setInfoModel:(PersonalInfoModel *)infoModel {
//    if (![BHSettingUtil dataAndStringIsNull:infoModel]) {
//        [self.nameButton setTitle:[BHSettingUtil dataAndStringIsNull:infoModel.company_name] ? @"登录/注册" : infoModel.company_name forState:UIControlStateNormal];
//        self.nextImage.hidden = self.addressLabel.hidden = [BHSettingUtil dataAndStringIsNull:infoModel.company_name];
//        [self.headImage sd_setImageWithURL:[NSURL URLWithString:infoModel.UserPhoto] placeholderImage:[UIImage imageNamed:@"icon_default_portrait"]];
//    }
//}

#pragma mark - 按钮
- (void)nameButtonClick:(UIButton *)sender {
    if (self.baseProtocol && [self.baseProtocol respondsToSelector:@selector(loginProtocol)]) {
        [self.baseProtocol loginProtocol];
    }
}

//- (void)personalClick:(UIButton *)sender {
//    if (self.homeProtocol && [self.homeProtocol respondsToSelector:@selector(homeColumnView:didSelect:)]) {
//        [self.homeProtocol homeColumnView:self didSelect:1];
//    }
//}

@end
